<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Debug with SourceMap</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="noindex,nofollow">

    <!-- Le styles -->
    <link href="../assets/css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <script src="../assets/js/require-simple.js"></script>
    <script>require.paths.unshift("../assets/js")</script>
    <script src="../assets/js/source-map-inspector.js"></script>
    <script src="fib.jsx.js"></script>
    <script>
      window.addEventListener("load", function (e) {
        document.getElementById("run").addEventListener("click", function (e) {
          e.stopPropagation();
          e.preventDefault();

          var jsFile = document.getElementById("source").dataset.file;
          console.assert(jsFile);
          var jsxFile = "system:example/" + jsFile.replace(/\.js$/, "");
          JSX.runMain(jsxFile, []);
        });
      });
    </script>

  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="/">JSX</a>
          <div class="nav-collapse">
            <ul class="nav">
              <li><a href="../">Try</a></li>
              <li class="active"><a href="../source-map/">Debug with SourceMap</a></li>
              <li><a href="../example/">Web Application Examples</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container">
      <div class="row">
        <div class="span8">
          <h2>SourceMap</h2>
          <p><a href="https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit">SourceMap</a> makes debugging JSX easy; you will see the original JSX source code instead of compiled JavaScript source code in the debugger. Symbol name mapping is not supported completely, though.</p>
          <p>Currently <a href="https://developers.google.com/chrome/">Chrome 18+</a> supports SourceMap. Open the JavaScript Console and tern <em>"Enable source mapps"</em> on in the settings.</p>
        </div>
      </div>
      <div class="row">
        <div class="span8">
          <p><a class="btn btn-primary btn-large" id="run">Run the script</a></p>
        </div>
      </div>

      <h2>Look & Feel</h2>
      <div class="row">
        <div class="span8">
          <p>Debugging JSX in Chrome JavaScript Console:</p>
          <p><img src="../assets/img/debug-console.png" /></p>
        </div>
      </div>

      <h2>How it maps</h2>
      <div class="row" id="source" data-file="fib.jsx.js">
      <pre class="span5 linenums" id="original"></pre>
      <pre class="span5 linenums" id="generated"></pre>
      </div>

    </div> <!-- /container -->

  </body>
</html>
